
LIB_PLATFORM = $(PLATFORM_LIB_NAME).a


INCLUD_PATH = -I./

CFLAGS =  -Wall -g ${INCLUD_PATH} 
ifeq ($(BUILD_TYPE), debug)
CFLAGS += -DALIOT_DEBUG
endif

#path of include files of mbedtls
ifeq ($(shell uname -s),Linux)
SRC_FILE = $(wildcard ./linux/*.c)
endif

$(info platform_src_files = $(SRC_FILE))


OBJ = $(patsubst %.c,%.o, ${SRC_FILE})
CFILE = $(patsubst %.o,%.c, ${OBJ})


.PHONY:clean all

all: ${LIB_PLATFORM}
	$(info platform library name is: $(LIB_PLATFORM))

${LIB_PLATFORM}: ${OBJ} 
	$(AR) $(ARFLAGS) $@ $(OBJ)
	cp ${LIB_PLATFORM} ../../build_out/


${OBJ}:%.o:%.c
	$(CC) $(CFLAGS) -c $^ -o $@

clean:
	-rm ${OBJ} *.a

